package cn.com.elite;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Random;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class Util {
	private static final Log log=LogFactory.getLog(Util.class);
	public static String getERRO(Exception e){
		String str="";
		try{
            StringWriter sw=new StringWriter();  
            e.printStackTrace(new PrintWriter(sw,true));  
            str=sw.toString(); 	
		}catch(Exception e1){
			str=e.toString();
			log.error("getERRO:"+e1.toString());
		}
		return str;
	}
	public static void main(String[] args){
		System.out.println(ReturnCode());
		
	}
	public static String getString(Object obj){
		if(obj==null){
			return "";
		}else{
			return obj.toString().replace(" ","");
		}
	}
	public static String ReturnCode(){
		Random r=new Random();
		int i=0;
		String str="";
		String s=null;
		while (i<9){
			switch(r.nextInt(10)){
			case (0): s = "0"; break;
		    case (1): s = "1"; break;
		    case (2): s = "2"; break;
		    case (3): s = "3"; break;
		    case (4): s = "4"; break;
		    case (5): s = "5"; break;
		    case (6): s = "6"; break;
		    case (7): s = "7"; break;
		    case (8): s = "8"; break;
		    case (9): s = "9"; break;
			}
			i++;
			str=s+str;
		}
		return "5"+str;
	}
	
	public static String ReturnCode1(int m){
		Random r=new Random();
		int i=0;
		String str="";
		String s=null;
		while (i<m){
			switch(r.nextInt(10)){
			case (0): s = "0"; break;
		    case (1): s = "1"; break;
		    case (2): s = "2"; break;
		    case (3): s = "3"; break;
		    case (4): s = "4"; break;
		    case (5): s = "5"; break;
		    case (6): s = "6"; break;
		    case (7): s = "7"; break;
		    case (8): s = "8"; break;
		    case (9): s = "9"; break;
			}
			i++;
			str=s+str;
		}
		return str;
	}
}
